import win32gui
import cv2
import pyautogui
import numpy as np
#p=dir(win32gui)
#for x in p:
#	print(x)
def _Call(hwnd,extra):
	windows=extra
	tmp=[]
	tmp.append(hex(hwnd))
#	tmp.append(win32gui.GetClassName(hwnd))
#	tmp.append(win32gui.GetWindowText(hwnd))
	tmp.append(win32gui.GetWindowRect(hwnd))
	# and this is real.
	windows[hwnd]=tmp
	win32gui.EnumChildWindows(hwnd,_Call,extra)
# so what is more?
# i guess it is the thing passing to the function.
# some variables are not directly importable or hard-codes. so it is not in the file.

def Enum():
	w={}
	ky=pyautogui.screenshot()
# and that's the creek.
#.convert("L")
	ky=np.array(ky)
	win32gui.EnumWindows(_Call,w)
	for item in w:
		print(w[item])
		x0,y0,x1,y1=w[item][1]
		cv2.rectangle(ky,(x0,y0),(x1,y1),(255,0,0),2)
	cv2.imshow("sample",ky)
	cv2.waitKey(0)
# the color here is BGR.
Enum()
# so this is it? I need a better view here.
# pywinauto. -> UIA/MSAA
# guess what? now we have to check the function.
# this is not good at all. not efficient.
# but what is the other way?
# is it fast enough by not printing out?
# well, get the position and be good.